<!DOCTYPE html>
<html ng-app="app" ng-controller="indexCtrl">

<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="Expires" content="0">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="Cache" content="no-cache">
    <title>广告投放-广告主</title>
	<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" id="favicon">
    <link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css" />
    <link rel="stylesheet" href="css/bootstrap-datetimepicker.min.css" />
    <link rel="stylesheet" href="css/base.css" />
    <link rel="stylesheet" href="modules/agent/agActive/agActive.css" />
    <link rel="stylesheet" href="http://res1.hubcloud.com.cn/lib/layer/skin/default/layer.css?v=3.0.3303" id="layuicss-skinlayercss">
    <link rel="stylesheet" href="../../oem/css/common.css" />
    <style>

    </style>
</head>

<body>
        <div class="nav_top">
                <div class="logo fl" id="logo">
                </div>
                <ul class="nav_list fl">
                    <!-- ngIf: permission.view['首页'] -->
                    <li ng-if="permission.view['首页']" class="ng-scope"><a ui-sref="agent.home" ui-sref-active="active"
                            href="./agentIndex.html" class="" >首页</a></li><!-- end ngIf: permission.view['首页'] -->
                    <!-- ngIf: permission.view['投放管理'] -->
                    <li ng-if="permission.view['投放管理']" class="ng-scope">
                        <!--<a ui-sref="agent.delivery" ui-sref-active="active">投放管理</a>-->
                        <a href="./active.html" class="toFirstSub active" >投放管理</a>
                        <ul class="nav_dropdown" style="width: 1903px;">
                            <!-- ngIf: permission.view['投放管理'].sub['活动管理'] -->
                            <li ng-if="permission.view['投放管理'].sub['活动管理']" class="ng-scope"><a href="./active.html"
                                    ui-sref-active="active" ui-sref="agent.delivery.active" class="" >活动管理</a></li>
                            <!-- end ngIf: permission.view['投放管理'].sub['活动管理'] -->
                            <!-- ngIf: permission.view['投放管理'].sub['订单管理'] -->
                            <li ng-if="permission.view['投放管理'].sub['订单管理']" class="ng-scope"><a href="./order.html"
                                    ui-sref-active="active" ui-sref="agent.delivery.order" class="" >订单管理</a></li>
                            <!-- end ngIf: permission.view['投放管理'].sub['订单管理'] -->
                            <!-- ngIf: permission.view['投放管理'].sub['素材信息'] -->
                            <li ng-if="permission.view['投放管理'].sub['素材信息']" class="ng-scope"><a href="./creative.html"
                                    ui-sref-active="active" ui-sref="agent.delivery.creative" class="" >素材信息</a></li>
                            <!-- end ngIf: permission.view['投放管理'].sub['素材信息'] -->
                            <!-- ngIf: permission.view['投放管理'].sub['APP监测'] -->
                            <li ng-if="permission.view['投放管理'].sub['APP监测']" class="ng-scope"><a href="./audiences.html"
                                    ui-sref-active="active" ui-sref="agent.delivery.audiences" class="" >监测管理</a></li>
                            <!-- end ngIf: permission.view['投放管理'].sub['APP监测'] -->
                            <!-- ngIf: hasDepot -->
                        </ul>
                    </li><!-- end ngIf: permission.view['投放管理'] -->
                    <!-- ngIf: permission.view['报表中心'] -->
                    <li ng-if="permission.view['报表中心']" class="ng-scope">
                        <!--<a ui-sref="agent.report" ui-sref-active="active">报表</a>-->
                        <a href="./baoBiao.html" class="toFirstSub"
                            ng-class="{'active':$state.includes('agent.report.*')}">报表中心</a>
                        <ul class="nav_dropdown" style="width: 1903px;">
                            <!-- ngIf: permission.view['报表中心'].sub['效果报表'] -->
                            <li ng-if="permission.view['报表中心'].sub['效果报表']" class="ng-scope"><a href="./baoBiao.html"
                                    ui-sref-active="active"
                                    ui-sref="agent.report.effect({'activeID':'0','activeName':'0','orderID':'0','orderName':'0'})"
                                    class="">效果报表</a></li><!-- end ngIf: permission.view['报表中心'].sub['效果报表'] -->
                                    <li ng-if="permission.view['合约报表'].sub['效果报表']" class="ng-scope">
							<a href="./heyuebaobiao.html" ui-sref-active="active" ui-sref="agent.report.effect({'activeID':'0','activeName':'0','orderID':'0','orderName':'0'})" class="">合约报表</a>
						</li>
                           
                        </ul>
                    </li><!-- end ngIf: permission.view['报表中心'] -->
                    <!-- ngIf: permission.view['系统管理'] -->
                    <li ng-if="permission.view['系统管理']" class="ng-scope">
                        <a href="./baseInfo.html" class="toFirstSub"
                            ng-class="{'active':$state.includes('agent.manage.*')}">系统管理</a>
                        <ul class="nav_dropdown" style="width: 1903px;">
                            <!-- ngIf: permission.view['系统管理'].sub['基本信息'] -->
                            <li ng-if="permission.view['系统管理'].sub['基本信息']" class="ng-scope"><a href="./baseInfo.html"
                                    ui-sref-active="active" ui-sref="agent.manage.baseInfo" class="">基本信息</a></li>
                            <!-- end ngIf: permission.view['系统管理'].sub['基本信息'] -->
                            <!-- ngIf: permission.view['系统管理'].sub['资质管理'] -->
                            <li ng-if="permission.view['系统管理'].sub['资质管理']" class="ng-scope"><a href="./qualifications.html"
                                    ui-sref-active="active" ui-sref="agent.manage.qualifications" class="">资质管理</a></li>
                            <!-- end ngIf: permission.view['系统管理'].sub['资质管理'] -->
                        </ul>
                    </li><!-- end ngIf: permission.view['系统管理'] -->
                    <!-- ngIf: permission.view['财务管理'] -->
                    <li ng-if="permission.view['财务管理']" class="ng-scope">
                        <!--<a ui-sref="agent.finance" ui-sref-active="active">财务管理</a>-->
                        <a href="./caiwu.html" class="toFirstSub"
                            ng-class="{'active':$state.includes('agent.finance.*')}">财务管理</a>
                        <ul class="nav_dropdown" style="width: 1903px;">
                            <!-- ngIf: permission.view['财务管理'].sub['财务信息'] -->
                            <li ng-if="permission.view['财务管理'].sub['财务信息']" class="ng-scope"><a href="./caiwu.html"
                                    ui-sref-active="active" ui-sref="agent.finance.trade" class="">财务信息</a></li>
                            <!-- end ngIf: permission.view['财务管理'].sub['财务信息'] -->
                        </ul>
                    </li><!-- end ngIf: permission.view['财务管理'] -->
                </ul>
                <div class="user">
                    <div class="user-avatar"></div>
                    <div class="user-info">
                        <p ng-bind="advUser.loginName" class="ng-binding">昌投网络科技-C1</p>
                        <p ng-bind="advUser.name" class="ng-binding">上海昌投网络科技有限公司1</p>
                    </div>
                    <ul class="user-list">
                        <li class="ng-binding">余额：</li>
                        <li ng-show="permission.act['退出登录']" ng-click="logout()" class="">退出登录</li>
                    </ul>
                </div>
            </div>
    <ui-view class="ng-scope">
        <!-- uiView:  -->
        <ui-view class="ng-scope">
            <!-- uiView:  -->
            <ui-view class="ng-scope">
                <div class="active-page page ng-scope">
                    <!--页面标题-->
                    <h3 class="page-title">活动管理</h3>
                    <div class="chargeBox">
                        <!--<div class="filter-box dateBox">-->
                        <!--<dropdown-date callback="chooseDate"></dropdown-date>-->
                        <!--</div>-->
                        <div class="filter-box">
                            <div class="dropdown dropdown-filter ng-isolate-scope" ng-class="{disabled:disabled}" list="select"
                                callback="chooseStatus"> 
                                <button class="btn btn-default dropdown-toggle cl" data-toggle="dropdown">
                                    <span style="width: 55%; display: inline-block;" class="ng-binding" id="search_value">选择状态</span>
                                    <!-- <span ng-show="publish" class="estimate ng-hide"> 
                                        <span class="ng-binding">流量占比：%</span>
                                        <span style="width: %"></span> 
                                    </span>  -->
                                </button> 
                                <span class="caret"></span>
                                <ul class="dropdown-menu">
                                    
                                    <li class="cl ng-scope" ng-repeat="item in list" data-state=null onclick="huoDongXiaLa(this)"> <a
                                            title="全部" href="javascript:;" class="ng-binding">全部</a> 
                                            <!-- <span ng-show="publish"
                                            class="estimate fl ng-hide"> <span class="ng-binding">流量占比：%</span> <span
                                                style="width: %"></span> </span>  -->
                                            </li>
                                    <li class="cl ng-scope" ng-repeat="item in list" data-state="1" onclick="huoDongXiaLa(this)"> <a
                                            title="开启" href="javascript:;" class="ng-binding">开启</a> 
                                            <!-- <span ng-show="publish"
                                            class="estimate fl ng-hide"> <span class="ng-binding">流量占比：%</span> <span
                                                style="width: %"></span> </span>  -->
                                            </li>
                                    <li class="cl ng-scope" ng-repeat="item in list" data-state="2" onclick="huoDongXiaLa(this)"> <a
                                            title="暂停" href="javascript:;" class="ng-binding">暂停</a> 
                                            <!-- <span ng-show="publish"
                                            class="estimate fl ng-hide"> <span class="ng-binding">流量占比：%</span> <span
                                                style="width: %"></span> </span> -->
                                             </li>
                                </ul>
                            </div>
                            <a href="./agNewActive.html"><button ng-if="obj.permission.act[&quot;活动&quot;].sub[&quot;新建&quot;]"
                                type="button" class="btn btn-info newActive ng-scope" ui-sref="agent.newActive({'appID':'0'})"
                                >新建活动</button></a>

                        </div>
                    </div>
                    <!--表格-->
                    <div class="table-box">
                        <div class="table-title">
                            <h3 class="table-title-font">活动列表</h3>
                        </div>
                        <table>
                            <thead>
                                <tr>
                                    <!--<th><check module="allCheck" callback="allCheckFunc"></check></th>-->
                                    <!-- ngIf: obj.permission.act["活动"].sub["编辑"] -->
                                    <th ng-if="obj.permission.act[&quot;活动&quot;].sub[&quot;编辑&quot;]" class="ng-scope">状态</th><!-- end ngIf: obj.permission.act["活动"].sub["编辑"] -->
                                    <th>ID</th>
                                    <th>名称</th>
                                    <th>频次</th>
                                    <th>总预算</th>
                                    <th>日预算</th>
                                    <th>活动时间</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                <!-- ngRepeat: item in activelist -->
                                <tr ng-repeat="item in activelist" class="ng-scope">
                                    <!--<td class="activeFlag" value="{{item.activityID}}"><check  module="activeIDs" value="{{item.activityID}}" callback="checkFunc"></check></td>-->
                                    <!-- ngIf: obj.permission.act["活动"].sub["编辑"] -->
                                    <td ng-if="obj.permission.act[&quot;活动&quot;].sub[&quot;编辑&quot;]" class="ng-scope">
                                        <div class="switch ng-isolate-scope" ng-class="{open:value.open}" ng-click="clickFunc()"
                                            ng-init="item.open = item.state == 10" callback="setStatus" value="item"></div>
                                    </td><!-- end ngIf: obj.permission.act["活动"].sub["编辑"] -->
                                    <td ng-init="activeId=item.activityID" class="ng-binding">9538</td>
                                    <td>
                                        <a ui-sref="agent.delivery.orderFilter({activeId:item.activityID})" class="ng-binding"
                                            href="#/agent/1/13197/delivery/order/9538">网赚</a>
                                    </td>
                                    <td class="frequency">
                                        <!-- ngIf: item.frequency ==''||item.frequency=='0' -->
                                        <div ng-init="item.editFlag = true" ng-show="item.editFlag" ng-if="item.frequency ==''||item.frequency=='0'"
                                            class="ng-scope">
                                            不限定
                                        </div><!-- end ngIf: item.frequency ==''||item.frequency=='0' -->

                                        <!-- ngIf: item.frequency !=''&&item.frequency!='0' -->

                                        <!-- 以下注释是显示input框的数量 -->
                                        <!-- <div class="edit-box ng-hide" ng-show="!item.editFlag">
                                            <input type="text" class="form-control ng-pristine ng-untouched ng-valid ng-empty"
                                                ng-model="changeNum">
                                            <b class="icon icon-ok" ng-click="changeFre(item,changeNum);"></b>
                                            <b class="icon icon-cancel" ng-click="item.editFlag = !item.editFlag"></b>
                                        </div> -->
                                    </td>
                                    <td class="ng-binding">无限制</td>
                                    <td class="ng-binding">无限制</td>
                                    <!-- ngIf: !item.endTime -->
                                    <td ng-if="!item.endTime" class="ng-binding ng-scope">2018-11-05-不限</td><!-- end ngIf: !item.endTime -->
                                    <!-- ngIf: item.endTime -->
                                    <td>
                                        <!-- ngIf: obj.permission.act["活动"].sub["编辑"] --><a ng-if="obj.permission.act[&quot;活动&quot;].sub[&quot;编辑&quot;]"
                                            ui-sref="agent.newActive({'appID':item.activityID})" class="ng-scope" href="#/agent/1/13197/agNewActive/9538">编辑</a><!-- end ngIf: obj.permission.act["活动"].sub["编辑"] -->
                                        <!-- ngIf: obj.permission.act["活动"].sub["新建"] --><a ng-if="obj.permission.act[&quot;活动&quot;].sub[&quot;新建&quot;]"
                                            ng-click="newOrder(item)" style="cursor: pointer;" class="ng-scope" id="xinJianDingDan">新建订单</a><!-- end ngIf: obj.permission.act["活动"].sub["新建"] -->
                                        <!-- ngIf: obj.permission.act["活动"].sub["查看报表"] --><a ng-if="obj.permission.act[&quot;活动&quot;].sub[&quot;查看报表&quot;]"
                                            ui-sref="agent.report.effect({'activeID':item.activityID,'activeName':item.name,'orderID':'0','orderName':'0'})"
                                            class="ng-scope" href="#/agent/1/13197/report/effect/9538/%E7%BD%91%E8%B5%9A/0/0">查看报表</a><!-- end ngIf: obj.permission.act["活动"].sub["查看报表"] -->
                                    </td>
                                </tr>
                                <!-- end ngRepeat: item in activelist -->
                                <!-- <tr ng-repeat="item in list">
                                <td><check></check></td>
                                <td><switch module="true"></switch></td>
                                <td ng-bind="item.activityID">204898</td>
                                <td ng-bind="item.name">asd</td>
                                <td class="frequency"  ng-init="item.editFlag = true">
                                <div ng-show="item.editFlag">
                                {{item.frequency}}次/{{item.frequencyUnit == "hour"?"小时":"天"}} <b class="icon-edit" ng-click="item.editFlag = !item.editFlag"></b>
                                </div>
                                <div class="edit-box" ng-show="false">
                                <input type="text" class="form-control"/>
                                <b class="icon icon-ok" ng-click="item.editFlag = !item.editFlag"></b>
                                <b class="icon icon-cancel" ng-click="item.editFlag = !item.editFlag"></b>
                                </div>
                                </td>
                                <td ng-bind="item.totalBudget"></td>
                                <td>0</td>
                                <td>0</td>
                                <td>
                                <a href="javascript:;">编辑</a>
                                <a href="javascript:;">新建广告单元</a>
                                <a href="javascript:;">查看报表</a>
                                </td>
                                </tr> -->

                                <tr class="ng-scope">
                                    <td  class="ng-scope">
                                        <div class="switch ng-isolate-scope" ></div>
                                    </td>
                                    <td class="ng-binding">9538</td>
                                    <td>
                                        <a class="ng-binding" href="#/agent/1/13197/delivery/order/9538">网赚</a>
                                    </td>
                                    <td class="frequency">
                                        <div class="ng-scope">不限定</div>
                                    </td>
                                    <td class="ng-binding">无限制</td>
                                    <td class="ng-binding">无限制</td>
                                    <td class="ng-binding ng-scope">2018-11-05-不限</td>
                                    <td>
                                        <a class="ng-scope" href="#/agent/1/13197/agNewActive/9538">编辑</a>
                                        <a style="cursor: pointer;" class="ng-scope" id="xinJianDingDan">新建订单</a>
                                        <a class="ng-scope" href="#/agent/1/13197/report/effect/9538/%E7%BD%91%E8%B5%9A/0/0">查看报表</a>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div id="pageToolbar" class="page">
                        <div id="Paging_07247478434465715" class="ui-paging-container">
                            <ul id="fenYe">
                                <!-- <li data-page="1" class="ui-pager focus">1</li>
                                <li data-page="2" class="ui-pager">2</li> -->
                                <li class="js-page-first js-page-action ui-pager" id="shouYe">首页</li>
                                <!-- <li class="js-page-prev js-page-action ui-pager ui-pager-disabled" id="shangYiYe">上一页</li> -->
                                <li class="js-page-prev js-page-action ui-pager" id="shangYiYe">上一页</li>
                    
                                <li class="ui-paging-toolbar"><span>跳转到</span>
                                    <input type="text" class="ui-paging-count" id="zhiDing" onkeydown='if(event.keyCode==13){huiChe(this)}'> 页
                                    <select class="ui-select-pagesize" id="meiYeTiaoShu">
                                        <option value="20">每页展示20条/页</option>
                                        <option value="50">每页展示50条/页</option>
                                        <option value="100">每页展示100条/页</option>
                                    </select><span> </span></li>
                                <!-- <li class="js-page-last js-page-action ui-pager ui-pager-disabled" id="moYe">末页</li> -->
                                <li class="js-page-last js-page-action ui-pager" id="moYe">末页</li>
                                <!-- <li class="js-page-next js-page-action ui-pager ui-pager-disabled" id="xiaYiYe">下一页</li> -->
                                <li class="js-page-next js-page-action ui-pager" id="xiaYiYe">下一页</li>

                            </ul>
                        </div>
                    </div>

                </div>
                <div class="orderType ng-scope" ng-click="clearLayer()">
                    <a ui-sref="agent.delivery.newOrder({oType: '1', orderId: '','activeId':activeId})" id="jingJiaJiaoYi">
                        <div>
                            <img src="./images/pic-contract.png" alt="">
                        </div>
                        <p>竞价交易</p>
                    </a>
                    <!-- <a ui-sref="agent.delivery.newOrder({oType: '2', orderId: '','activeId':activeId})" id="heYueJiaoYi">
                        <div>
                            <img src="./images/pic-bid.png" alt="">
                        </div>
                        <p>合约交易</p>
                    </a> -->
                </div>
            </ui-view>
        </ui-view>
    </ui-view>



   
</body>

</html>
<script src="../res1.hubcloud.com.cn/lib/jquery/jquery.min.js"></script>


<script src="../res1.hubcloud.com.cn/lib/layer/layer.js"></script>
<script src="../res1.hubcloud.com.cn/lib/bootstrap/js/bootstrap.min.js"></script>
<script src="../res1.hubcloud.com.cn/lib/calendar/calendar.js"></script>

<script src="../res1.hubcloud.com.cn/lib/qiniu/plupload/moxie.js"></script>
<script src="../res1.hubcloud.com.cn/lib/query.js"></script>
<script src="../res1.hubcloud.com.cn/lib/paging.js"></script>
<script src="js/commen.js?rand=v1.0.54"></script>
<script src="js/js_1.js"></script>




<script>
    var page=1;             //第几页
    var pageSize=20;         //一页多少条
    var state=null;         //搜索状态
    var allPageNum=null;    //总页数
    $(function () {
        getAllAdActivity(page,pageSize,state);
        $(document).on('click','#xinJianDingDan', function () {
            layer.open({
                type: 1,
                title: "新建广告订单",
                skin: "layer-style",
                area: ['660px', '380px'], //宽高
                content: $(".orderType")
            });
            let newDingDan=$(this).parent().parent().children().eq(2).text(); 
            sessionStorage.setItem('newDingDan',newDingDan);

        })

        $("#shouYe").on('click', function () {
            page=1;
            getAllAdActivity(page,pageSize,state);
        })

        //上一页
        $('#shangYiYe').on('click',function(){
            if(page==1){
                layer.msg("当前已是第一页");
                return false;
            }else{
                page=--page;
                getAllAdActivity(page,pageSize,state);
            }
            
        })

        
        //下一页
        $('#xiaYiYe').on('click',function(){
            if(page==allPageNum){
                layer.msg("当前已是最后一页");
                return false;
            }else{
                page=++page;
                getAllAdActivity(page,pageSize,state);
            }
            
        })

        //末页
        $('#moYe').on('click',function(){
            if(page==allPageNum){
                layer.msg("当前已是最后一页");
                return false;
            }else{
                page=allPageNum;
                getAllAdActivity(page,pageSize,state);
            }
            
        })

        // 下拉选择一页显示多少数据
        $("#meiYeTiaoShu").change(function(){
            //获取当前select选择的值
            var selectVal = $("#meiYeTiaoShu option:selected").val();
            pageSize=selectVal;
            getAllAdActivity(page,pageSize,state);
            
        });

        // 竞价交易
        $('#jingJiaJiaoYi').on('click',function(){
            location.href="./newOrder.html";
        })

        
    })


    // 查询活动列表（重要）
    function getAllAdActivity(page,pageSize,state){
        $("#zhiDing").val(page);
        let token=sessionStorage.getItem("token");
        var d = {};
        d.page = page;
        d.pageSize = pageSize;
        if(!state){
            d.state = null;
        }else{
            d.state = state;
        }
        $.ajax({
            url: url + "/advertiser/adActivity/pageAdActivityState",
            type: 'POST',
            //		参数需转为字符串
            data: JSON.stringify(d),
            //		json跨域
            dataType: 'json',
            //		contentType类型为json
            contentType: "application/json",

            //		请求头加上X-Token 
             beforeSend: function(XMLHttpRequest) {
                //		token 为页面所获取
                
    			XMLHttpRequest.setRequestHeader("X-Token", token); 
            },
            useDefaultXhrHeader: false,
            success: function(result) {
                console.log(result)

                if(result.code == '0') {
                    getListData(result.data.rows);
                    if(result.data.total>0){
                        if(result.data.total%pageSize==0){
                            allPageNum=result.data.total/pageSize;
                        }else{
                            allPageNum=parseInt(result.data.total/pageSize)  + 1
                        }

                        $('#fenYe').children('.a').remove();
                        let html = '';
                        for(let i=0;i<allPageNum;i++){
                            if(i!=page-1){
                                html +=` <li data-page="${i+1}" class="ui-pager a" onclick="qieHuan(this)" >${i+1}</li>`;
                            }else{
                                html +=` <li data-page="${i+1}" class="ui-pager focus a" onclick="qieHuan(this)">${i+1}</li>`;
                            }
                        }
                        $('#fenYe').append(html); 
                    }
                } else {
                    isErr(result);
                }
            },
            err: function(err) {
                layer.msg("请求失败");
            },
            complete: function() {
                // $(_that).removeAttr("disabled");
            }
        });
    }

    //加载列表数据
    function getListData(listData){

        console.log(listData);

        $('tbody').html("");  
        let html = '';
        listData.forEach(item => {
            html +=`<tr class="ng-scope">
                        <td  class="ng-scope">
                            <div class="switch ng-isolate-scope ${item.state==1?'open':''}" onclick="gengGaiZhuangTai(this)" data-id='${item.id}'></div>
                        </td>
                        <td class="ng-binding">${item.id}</td>
                        <td>
                            <a class="ng-binding" href="#/agent/1/13197/delivery/order/9538" onclick="goOrderPage(this)">${item.name}</a>
                        </td>
                        <td class="frequency">
                            <div class="ng-scope">${item.times==null?'不限定':item.times}</div>
                        </td>
                        <td class="ng-binding">${item.allBudget==null?'无限制':item.allBudget}</td>
                        <td class="ng-binding">${item.dayBudget==null?'无限制':item.dayBudget}</td>
                        <td class="ng-binding ng-scope">2018-11-05~${item.acTimeEnd==null?'不限':item.acTimeEnd}</td>
                        <td>
                            <a class="ng-scope" href="./agNewActive2.html?id=${item.id}" >编辑</a>
                            <a style="cursor: pointer;" class="ng-scope" id="xinJianDingDan">新建订单</a>
                            <a class="ng-scope" href="./baoBiao.html?id=${item.id}">查看报表</a>
                        </td>
                    </tr>`;

        })
        $('tbody').append(html);        
    }

    function gengGaiZhuangTai(e){
        
        let id=$(e).attr("data-id");
        if ($(e).hasClass("open")) {
            $(e).removeClass('open');
            updateAdactivityById(id,2)
        } else {
            $(e).addClass('open');
            updateAdactivityById(id,1)
        }
    }

    function xiaBiaoLine(e){
        console.log(e);
        $(e).addClass('active');
    }
    //根据ID更改活动状态
    function updateAdactivityById(id,state){
        let token=sessionStorage.getItem("token");
        var d = {};
        d.id = id;
        d.state = state;
        $.ajax({
            url: url + "/advertiser/adActivity/updateAdactivityById", 
            // url: url + "/common/industrySmall/"+id,
            type: 'POST',
            //		参数需转为字符串
            data: JSON.stringify(d),
            //		json跨域
            dataType: 'json',
            //		contentType类型为json
            contentType: "application/json",

            //		请求头加上X-Token 
             beforeSend: function(XMLHttpRequest) {
                //		token 为页面所获取
    			XMLHttpRequest.setRequestHeader("X-Token", token); 
            },
            useDefaultXhrHeader: false,
            success: function(result) {
                console.log(result);
                // if(result.code == '0') {
                //     getListData(result.data);
                // } else {
                //     isErr(result);
                // }
            },
            err: function(err) {
                layer.msg("请求失败");
            },
            complete: function() {
                // $(_that).removeAttr("disabled");
            }
        });
    }

    //跳转订单管理
    function goOrderPage(e){
        console.log(e);
        let name=$(e).text();
        localStorage.setItem("order_search_content",name);
        location.href="order.html";
    }

    //状态搜索
    function state_search(e){
        $('#search_value').text($(e).children('a').text());
        state = $(e).attr("data-state");
        getAllAdActivity(page,pageSize,state);
    }

    function qieHuan(e){
        page =$(e).attr("data-page");
        getAllAdActivity(page,pageSize,state);
        // $(e).addClass('focus');
        // $(e).addClass('focus').siblings('a').removeClass('focus');
        
    }

    //回车页数
    function huiChe(e){
        let pageNum=$(e).val();
        if(pageNum>allPageNum){
            page=1;
        }else{
            page=pageNum
        }
        getAllAdActivity(page,pageSize,state);   
    }


    function huoDongXiaLa(e){
        $('#search_value').text($(e).children('a').text());
        let state=$(e).attr('data-state');
        console.log(state);
        sessionStorage.setItem("huoDongZhuangTai",state);
        getAllAdActivity(page,pageSize,state);   
    }
	$('.user').on('click', function() {
		$(this).toggleClass('hover');
	})
	
	$('.user').mouseleave(function() {
		$(this).removeClass('hover');
	});

</script>
<script src="../../oem/js/oem.js"></script>